package com.hobee.basic.config.datasource;

/**
 * @author junjie.li
 * @date 2020/6/29 18:21
 */
public enum DataSourceEnum {
    /**
     * 写
     */
    MASTER("master"),
    /**
     * 读
     */
    SLAVE("slave");

    private String codeName;

    private DataSourceEnum(String codeName) {
        this.codeName = codeName;
    }

    public String getCodeName() {
        return codeName;
    }

    public void setCodeName(String codeName) {
        this.codeName = codeName;
    }

    public static DataSourceEnum getDataSourceEnum(String codeName) {
        for (DataSourceEnum value : DataSourceEnum.values()) {
            if (value.getCodeName().equals(codeName)) {
                return value;
            }
        }
        return null;
    }
}
